﻿@{
    Layout = "";
}

@model ConfigurationModel
@using Spotshub.Plugin.Payments.GlobalPayments.Models;
@using Nop.Web.Framework;

@using (Html.BeginForm())
{
    <table class="adminContent">
        <tr>
            <td class="adminTitle">
                Version
            </td>
            <td class="adminData">
                2.0 (@Model.CodeVersion)
            </td>
        </tr>
        <tr>
            <td class="adminTitle">
                @Html.NopLabelFor(model => model.AdditionalFee):
            </td>
            <td class="adminData">
                @Html.EditorFor(model => model.AdditionalFee)
                @Html.ValidationMessageFor(model => model.AdditionalFee)
            </td>
        </tr>
        <tr>
            <td class="adminTitle">
                @Html.NopLabelFor(model => model.AdditionalFeePercentage):
            </td>
            <td class="adminData">
                @Html.EditorFor(model => model.AdditionalFeePercentage)
                @Html.ValidationMessageFor(model => model.AdditionalFeePercentage)
            </td>
        </tr>
        <tr>
            <td class="adminTitle">
                @Html.NopLabelFor(model => model.FormUrl):
            </td>
            <td class="adminData">
                @Html.EditorFor(model => model.FormUrl)
                @Html.ValidationMessageFor(model => model.FormUrl)
            </td>
        </tr>
        <tr>
            <td class="adminTitle">
                @Html.NopLabelFor(model => model.DirectServiceUrl):
            </td>
            <td class="adminData">
                @Html.EditorFor(model => model.DirectServiceUrl)
                @Html.ValidationMessageFor(model => model.DirectServiceUrl)
            </td>
        </tr>
        <tr>
            <td class="adminTitle">
                @Html.NopLabelFor(model => model.AllowedTypes):
            </td>
            <td class="adminData">
                @Html.EditorFor(model => model.AllowedTypes)
                @Html.ValidationMessageFor(model => model.AllowedTypes)
            </td>
        </tr>
        <tr>
            <td class="adminTitle">
                @Html.NopLabelFor(model => model.AuthorizeEndpoint):
            </td>
            <td class="adminData">
                @Html.EditorFor(model => model.AuthorizeEndpoint)
                @Html.ValidationMessageFor(model => model.AuthorizeEndpoint)
            </td>
        </tr>
        <tr>
            <td class="adminTitle">
                @Html.NopLabelFor(model => model.QueryEndpoint):
            </td>
            <td class="adminData">
                @Html.EditorFor(model => model.QueryEndpoint)
                @Html.ValidationMessageFor(model => model.QueryEndpoint)
            </td>
        </tr>
        <tr>
            <td class="adminTitle">
                @Html.NopLabelFor(model => model.UIdEndpoint):
            </td>
            <td class="adminData">
                @Html.EditorFor(model => model.UIdEndpoint)
                @Html.ValidationMessageFor(model => model.UIdEndpoint)
            </td>
        </tr>
        <tr>
            <td class="adminTitle">
                @Html.NopLabelFor(model => model.CallbackUrl):
            </td>
            <td class="adminData">
                @Html.EditorFor(model => model.CallbackUrl)
                @Html.ValidationMessageFor(model => model.CallbackUrl)
            </td>
        </tr>
        <tr>
            <td class="adminTitle">
                @Html.NopLabelFor(model => model.TestUrl):
            </td>
            <td class="adminData">
                @Html.EditorFor(model => model.TestUrl)
                @Html.ValidationMessageFor(model => model.TestUrl)
            </td>
        </tr>
        <tr>
            <td class="adminTitle">
                @Html.NopLabelFor(model => model.LogisticsCssUrl):
            </td>
            <td class="adminData">
                @Html.EditorFor(model => model.LogisticsCssUrl)
                @Html.ValidationMessageFor(model => model.LogisticsCssUrl)
            </td>
        </tr>
        <tr>
            <td class="adminTitle">
                @Html.NopLabelFor(model => model.LogisticsCallbackUrl):
            </td>
            <td class="adminData">
                @Html.EditorFor(model => model.LogisticsCallbackUrl)
                @Html.ValidationMessageFor(model => model.LogisticsCallbackUrl)
            </td>
        </tr>
        <tr>
            <td class="adminTitle">
                @Html.NopLabelFor(model => model.CommerceCssUrl):
            </td>
            <td class="adminData">
                @Html.EditorFor(model => model.CommerceCssUrl)
                @Html.ValidationMessageFor(model => model.CommerceCssUrl)
            </td>
        </tr>
        <tr>
            <td class="adminTitle">
                @Html.NopLabelFor(model => model.CommerceCallbackUrl):
            </td>
            <td class="adminData">
                @Html.EditorFor(model => model.CommerceCallbackUrl)
                @Html.ValidationMessageFor(model => model.CommerceCallbackUrl)
            </td>
        </tr>
        <tr>
            <td class="adminTitle">
                @Html.NopLabelFor(model => model.AppCssUrl):
            </td>
            <td class="adminData">
                @Html.EditorFor(model => model.AppCssUrl)
                @Html.ValidationMessageFor(model => model.AppCssUrl)
            </td>
        </tr>
        <tr>
            <td class="adminTitle">
                @Html.NopLabelFor(model => model.AppCallbackUrl):
            </td>
            <td class="adminData">
                @Html.EditorFor(model => model.AppCallbackUrl)
                @Html.ValidationMessageFor(model => model.AppCallbackUrl)
            </td>
        </tr>
        <tr>
            <td class="adminTitle">
                @Html.NopLabelFor(model => model.SandboxDirectServiceUrl):
            </td>
            <td class="adminData">
                @Html.EditorFor(model => model.SandboxDirectServiceUrl)
                @Html.ValidationMessageFor(model => model.SandboxDirectServiceUrl)
            </td>
        </tr>
        <tr>
            <td class="adminTitle">
                @Html.NopLabelFor(model => model.SandboxFormUrl):
            </td>
            <td class="adminData">
                @Html.EditorFor(model => model.SandboxFormUrl)
                @Html.ValidationMessageFor(model => model.SandboxFormUrl)
            </td>
        </tr>
        <tr>
            <td class="adminTitle">
                @Html.NopLabelFor(model => model.SandboxAPIToken):
            </td>
            <td class="adminData">
                @Html.EditorFor(model => model.SandboxAPIToken)
                @Html.ValidationMessageFor(model => model.SandboxAPIToken)
            </td>
        </tr>
        <tr>
            <td class="adminTitle">
                @Html.NopLabelFor(model => model.SandboxProfileId):
            </td>
            <td class="adminData">
                @Html.EditorFor(model => model.SandboxProfileId)
                @Html.ValidationMessageFor(model => model.SandboxProfileId)
            </td>
        </tr>
        <tr>
            <td class="adminTitle">
                @Html.NopLabelFor(model => model.EnableSandbox):
            </td>
            <td class="adminData">
                @Html.EditorFor(model => model.EnableSandbox)
                @Html.ValidationMessageFor(model => model.EnableSandbox)
            </td>
        </tr>
        <tr>
            <td class="adminTitle">
                @Html.NopLabelFor(model => model.EnableDebug):
            </td>
            <td class="adminData">
                @Html.EditorFor(model => model.EnableDebug)
                @Html.ValidationMessageFor(model => model.EnableDebug)
            </td>
        </tr>
        <tr>
            <td class="adminTitle">
                @Html.NopLabelFor(model => model.EnableLog):
            </td>
            <td class="adminData">
                @Html.EditorFor(model => model.EnableLog)
                @Html.ValidationMessageFor(model => model.EnableLog)
            </td>
        </tr>
        <tr>
            <td colspan="2">
                <br/>
                <input type="button" id="savegeneralsettings" class="t-button" value="@T("Admin.Common.Save")" />
                <script type="text/javascript">
                    $(function () {
                        $('#savegeneralsettings').click(function () {
                            $.ajax({
                                cache: false,
                                type: 'POST',
                                url: '@Url.RouteUrl("Plugin.Payments.GlobalPayments.SaveGeneralSettings")',
                                data: $(this.form).serialize(),
                                dataType: 'json',
                                success: function (data) {
                                    alert('Saved');
                                },
                                error: function (xhr, ajaxOptions, thrownError) {
                                    alert('Failed to add record.');
                                }
                            });
                            return false;
                        });
                    });
                </script>
            </td>
        </tr>
    </table>
}

@Html.Partial("_ProfileConfigure")